(in-package :cl-daisyui)


;; https://daisyui.com/components/alert/
(defmacro alert (class icon alert-text &rest attrs)
  `(spinneret:with-html
     (:div :role "alert" :class ,class ,@attrs
           ,@attrs
           ,icon
           ,alert-text)))

;; https://daisyui.com/components/loading/
(defmacro loading (class &rest attrs)
  `(spinneret:with-html
     (:span :class ,class ,@attrs)))

;; https://daisyui.com/components/progress/
(defmacro progress (class value &optional (max "100") &rest attrs)
  `(spinneret:with-html
     (:progress :class ,class
                :value ,value
                :max ,max
                ,@attrs)))

;; https://daisyui.com/components/radial-progress/
(defmacro radial-progress (class percent &optional (style "") &rest attrs)
  `(spinneret:with-html
     (:div :class ,class
           :style (format nil "--value:~d;~d" ,percent ,style)
           :role "progressbar"
           ,@attrs
           (format nil "~d%" ,percent))))

;; https://daisyui.com/components/tooltip/
(defmacro tooltip (class data-tip node &rest attrs)
  `(spinneret:with-html
     (:div :class ,class :data-tip ,data-tip ,@attrs
           ,node)))
